wayland: Some more debug spew
authorMatthias Clasen <mclasen@redhat.com>
Tue, 19 Apr 2016 16:43:03 +0000 (12:43 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 19 Apr 2016 16:43:03 +0000 (12:43 -0400)
Print the modifiers and their mapping out as well. This
information is contained in the keymap, but this is a bit
easier to digest.

gdk/wayland/gdkkeys-wayland.c

index a4f39d33d558d84f9e6f0a88f80a1e143a8ae89b..086e4de95683adffe9b336f7ad20c888dc73f558 100644 (file)
@@ -552,6 +552,46 @@ _gdk_wayland_keymap_new (void)
   return GDK_KEYMAP (keymap);
 }
 
+#ifdef G_ENABLE_DEBUG
+static void
+print_modifiers (struct xkb_keymap *keymap)
+{
+  int i, j;
+  uint32_t real;
+  struct xkb_state *state;
+
+  g_print ("modifiers:\n");
+  for (i = 0; i < xkb_keymap_num_mods (keymap); i++)
+    g_print ("%s ", xkb_keymap_mod_get_name (keymap, i));
+  g_print ("\n\n");
+
+  g_print ("modifier mapping\n");
+  state = xkb_state_new (keymap);
+  for (i = 0; i < 8; i++)
+    {
+      gboolean need_arrow = TRUE;
+      g_print ("%s ", xkb_keymap_mod_get_name (keymap, i));
+      for (j = 8; j < xkb_keymap_num_mods (keymap); j++)
+        {
+          xkb_state_update_mask (state, 1 << j, 0, 0, 0, 0, 0);
+          real = xkb_state_serialize_mods (state, XKB_STATE_MODS_EFFECTIVE);
+          if (real & (1 << i))
+            {
+              if (need_arrow)
+                {
+                  g_print ("-> ");
+                  need_arrow = FALSE;
+                }
+              g_print ("%s ", xkb_keymap_mod_get_name (keymap, j));
+            }
+        }
+      g_print ("\n");
+    }
+
+  xkb_state_unref (state);
+}
+#endif
+
 void
 _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
                                     uint32_t   format,
@@ -585,6 +625,8 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
       return;
     }
 
+  GDK_NOTE(INPUT, print_modifiers (xkb_keymap));
+
   xkb_keymap_unref (keymap_wayland->xkb_keymap);
   keymap_wayland->xkb_keymap = xkb_keymap;